/*     */ package com.zimbra.cs.account.accesscontrol;
/*     */ 
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.cs.account.accesscontrol.generated.UserRights;
/*     */ import java.util.EnumSet;
/*     */ import java.util.Set;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class UserRight
/*     */   extends Right
/*     */ {
/*     */   static void init(RightManager rm)
/*     */     throws ServiceException
/*     */   {
/*  28 */     UserRights.init(rm);
/*     */   }
/*     */   
/*     */   UserRight(String name) {
/*  32 */     super(name, Right.RightType.preset);
/*     */   }
/*     */   
/*     */   public boolean isUserRight()
/*     */   {
/*  37 */     return true;
/*     */   }
/*     */   
/*     */   public boolean isPresetRight()
/*     */   {
/*  42 */     return true;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private TargetType disguiseTargetType(TargetType targetType)
/*     */   {
/*  58 */     if (targetType == TargetType.calresource)
/*  59 */       return TargetType.account;
/*  60 */     if (targetType == TargetType.group) {
/*  61 */       return TargetType.dl;
/*     */     }
/*  63 */     return targetType;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   boolean executableOnTargetType(TargetType targetType)
/*     */   {
/*  70 */     targetType = disguiseTargetType(targetType);
/*  71 */     return super.executableOnTargetType(targetType);
/*     */   }
/*     */   
/*     */   boolean isValidTargetForCustomDynamicGroup()
/*     */   {
/*  76 */     return (this.mTargetType == TargetType.group) || (this.mTargetType == TargetType.dl);
/*     */   }
/*     */   
/*     */   boolean grantableOnTargetType(TargetType targetType)
/*     */   {
/*  81 */     targetType = disguiseTargetType(targetType);
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*  86 */     if (this.mGrantTargetType != null) {
/*  87 */       return this.mGrantTargetType == targetType;
/*     */     }
/*  89 */     return targetType.isInheritedBy(this.mTargetType);
/*     */   }
/*     */   
/*     */ 
/*     */   Set<TargetType> getGrantableTargetTypes()
/*     */   {
/*  95 */     if (this.mGrantTargetType != null) {
/*  96 */       return EnumSet.of(this.mGrantTargetType);
/*     */     }
/*  98 */     return this.mTargetType.inheritFrom();
/*     */   }
/*     */   
/*     */   boolean allowSubDomainModifier()
/*     */   {
/* 103 */     return false;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   boolean overlaps(Right other)
/*     */     throws ServiceException
/*     */   {
/* 115 */     return this == other;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/accesscontrol/UserRight.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */